//
//  NSObject+KTableModel.h
//  MengLiao
//
//  Created by xiuxin on 2022/7/15.
//  Copyright © 2022 HZMengLiao. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

typedef void (^KCellConfigBlock)(__kindof UITableViewCell * cell, id model, NSIndexPath * indexPath);

typedef void (^KCellSelectBlock)(id model, NSIndexPath * indexPath);

typedef BOOL (^KCellDeleteConfirmBlock)(id model, NSIndexPath * indexPath);

typedef void (^KSectionConfigBlock)(__kindof UITableViewHeaderFooterView * headerFooterView, id model, NSInteger section);

@interface NSObject(KCellModel)

@property (copy,nonatomic) NSString * kCellIdentifier;

@property (copy,nonatomic) KCellConfigBlock kCellConfigBlock;

@property (copy,nonatomic) KCellSelectBlock kCellSelectBlock;

@property (strong,nonatomic) NSNumber * kCellHeight;

@property (strong,nonatomic) NSNumber * kCellCanDelete;

@property (strong,nonatomic) NSNumber * kCellCanMove;

@property (strong,nonatomic) NSArray<UITableViewRowAction *> * kActionList;

@end

@interface NSObject(KCellDelete)

@property (copy,nonatomic) KCellDeleteConfirmBlock kCellDeleteConfirmBlock;

@end

@interface NSObject(KSectionModel)

@property (copy,nonatomic) NSString * kSectionHeaderIdentifier;

@property (copy,nonatomic) NSString * kSectionFooterIdentifier;

@property (copy,nonatomic) NSString * kSectionIndexTitle;

@property (copy,nonatomic) KSectionConfigBlock kSectionHeaderConfigBlock;

@property (copy,nonatomic) KSectionConfigBlock kSectionFooterConfigBlock;

@property (strong,nonatomic) NSNumber * kSectionHeaderHeight;

@property (strong,nonatomic) NSNumber * kSectionFooterHeight;

@end

@interface KCommonTableModel : NSObject

@property (strong,nonatomic) id model;

@property (strong,nonatomic) id userInfo;

@property (copy,nonatomic) NSComparisonResult (^comparator)(KCommonTableModel * obj1, KCommonTableModel * obj2);

+ (KCommonTableModel *)cellModel:(id)model identifier:(NSString *)identifier;

+ (KCommonTableModel *)sectionModel:(id)model headerIdentifier:(NSString *)headerIdentifier footerIdentifier:(NSString *)footerIdentifier;

+ (NSArray<KCommonTableModel *> *)arrayModelListWithDataList:(NSArray *)dataList countPerCell:(NSInteger)count identifier:(NSString *)identifier;

@end
